<template>
    <div>
        <van-tree-select v-model:main-active-index="activeIndex" :items="store.state.cartlist" v-if="index === 0">
            <template #content>
                    <Foodlistitem :activeIndex="activeIndex" :list="store.state.cartlist[activeIndex].children" :show="false"></Foodlistitem>
            </template>
        </van-tree-select>
    </div>
</template>

<script>
import { reactive, toRefs } from 'vue';
import Foodlistitem from '../../components/store/Foodlistitem.vue'
import { useStore } from 'vuex';
export default {
    components: {
        Foodlistitem
    },
    props: ['index'],
    setup(props) {
        const store = useStore()
        let data = reactive({
            activeIndex: 0,
            checked: [],
            cartdetaillist:[]
        })
        // console.log(store.state.cartlist);
        return { ...toRefs(data), store }
    }
}
</script>

<style lang="scss" scoped>
.item {
    margin-top: 10px;
    display: flex;

    img {
        width: 60px;
        height: 60px;
    }

    .txt {
        margin-left: 10px;
        // margin-top: 10px;
        width: 80px;
        font-size: 14px;

        .stepper {
            margin-top: 5px;

        }

        :deep .van-stepper__input,
        :deep .van-stepper__minus,
        :deep .van-stepper__plus {
            width: 24px;
            height: 24px;
        }
    }

    .price {
        // margin-top: 5px;
        // margin-right: 20px;
        font-size: 14px;
        display: flex;
        flex-direction: column;
        align-items: center;

        :deep .van-icon-add-o:before {
            margin-top: 10px;
        }
    }
}

:deep .van-sidebar-item--select:before {
    background-color: #ffc400;
    width: 3px;
    // top: 9px;
    // left: -2px;
    height: 10px;
    // transform: translateX(20px);
    transition-duration: 0.3s;
    // position: relative;
}

:deep .van-sidebar-item__text {
    font-size: 10px;

}

:deep .van-tree-select__nav {
    padding-left: 35px;
    background: #fff;
}

:deep .van-tree-select {
    margin-top: 0px;
    height: 380px !important;
}

:deep .van-sidebar-item {
    margin-bottom: 7px;
    background-color: #fff;
    overflow: visible;
}

:deep .van-sidebar-item__text {
    font-size: 14px;
}
</style>